<?php

namespace admin\models;

use Yii;

/**
 * This is the model class for table "mm_user_meeting".
 *
 * @property integer $mm_id
 * @property integer $mu_id
 * @property integer $mu_targrt
 * @property integer $mm_date
 *
 * @property Info $mu
 * @property Info $muTargrt
 */
class UserMeeting extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'mm_user_meeting';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['mu_id', 'mu_targrt'], 'integer'],
            [['mu_targrt','mm_date'],'required'],
            [['mu_id'], 'exist', 'skipOnError' => true, 'targetClass' => UserInfo::className(), 'targetAttribute' => ['mu_id' => 'mi_id']],
            [['mu_targrt'], 'exist', 'skipOnError' => true, 'targetClass' => UserInfo::className(), 'targetAttribute' => ['mu_targrt' => 'mi_id']],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'mm_id' => '约会表id',
            'mu_id' => '用户id',
            'mu_targrt' => '约会对象',
            'mm_date'=>'约会时间'
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getMu()
    {
        return $this->hasOne(UserInfo::className(), ['mi_id' => 'mu_id']);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getMuTargrt()
    {
        return $this->hasOne(UserInfo::className(), ['mi_id' => 'mu_targrt']);
    }
}
